package controllers;

import java.util.List;

import models.conf.Settings;
import models.corp.Ranking;

import play.Play;
import play.jobs.OnApplicationStart;
import play.mvc.Controller;

@OnApplicationStart
public class ConfigurationLoader extends Controller {
	static {
		List<Ranking> rankings = Ranking.findAll();
		if (rankings.size() == 0) {
			Ranking newRank = new Ranking();
			newRank.save();
		} else if (rankings.size() > 1) {
			// log multiple rankings detected
		}

		Play.configuration.put(Settings.RANKINGS, Ranking.findAll().get(0));
	}
}
